package com.arpa.wms.mapper;

import com.arpa.wms.domain.dto.DeliveryDistributionDTO;
import com.arpa.wms.domain.dto.RecheckItemOperationDto;
import com.arpa.wms.domain.dto.RecheckOperationDto;
import com.arpa.wms.domain.entity.DeliveryDistribution;
import com.arpa.wms.domain.vo.DeliveryDistributionVO;
import com.arpa.wms.domain.vo.DeliveryItemWithDistributionVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 出货分配 Mapper 接口
 * </p>
 *
 * @author LEO
 * @since 2020-08-07
 */
public interface DeliveryDistributionMapper extends BaseMapper<DeliveryDistribution> {

    /**
     * 查询列表
     * @param deliveryDistributionDTO
     * @return
     */
    List<DeliveryDistributionVO> queryList(DeliveryDistributionDTO deliveryDistributionDTO);

    /**
     * 查询合计,包含总数
     * @param deliveryDistributionDTO
     * @return
     */
    DeliveryDistributionVO queryListSum(DeliveryDistributionDTO deliveryDistributionDTO);
     /**
      *  @author: Allen chen
      *  @Date: 2020/9/2 13:33
      *  @Description: 根据code批量更新状态
      */
    int batchUpdateStatus(@Param("list") List<String> list,@Param("status") Integer status,@Param("modifiedBy") String modifiedBy);

    /**
     * 根据出库表code获取分配与明细关联列表
     * @param deliveryCode
     * @return
     */
    List<DeliveryItemWithDistributionVO> queryWithItemList(@Param("deliveryCode") String deliveryCode, @Param("pickingCode") String pickingCode,@Param("groupCode")String groupCode);

    int adjustDistributeQuantity(DeliveryDistributionDTO deliveryDistributionDTO);

    /***
     * @description
     * 根据订单号，更新分配单拣货数量
     * @author xuyang
     * @date 2020/10/23 14:10
     * @param deliveryCode:
     **/
    int updatePickingQuantityForCheck(@Param("deliveryCode")String deliveryCode,@Param("groupCode")String groupCode);

    /***
     * @description
     * 根据订单号，更新分配单拣货数量
     * @author xuyang
     * @date 2020/10/23 14:10
     * @param deliveryCode:
     * @param recheckQuantity:
     * @param oldInventoryCode:
     **/
    int updateRechekQuantity(@Param("deliveryCode")String deliveryCode,@Param("oldInventoryCode") String oldInventoryCode,
                             @Param("recheckQuantity")BigDecimal recheckQuantity,@Param("recheckRefundQuantity")BigDecimal recheckRefundQuantity,
                             @Param("groupCode")String groupCode);


    int updatePickingQuantityStatusByWavePickingCode(@Param("wavePickingCode") String wavePickingCode,@Param("status") String status,@Param("groupCode") String groupCode);

    /**
     * 批量更新复核数量
     * @author rfwang
     * @date 2021/12/20 20:12
     * @param recheckItemOperationDtoList
     * @return
     */
    void batchRecheck(List<RecheckItemOperationDto> recheckItemOperationDtoList);
}
